package dominion.kingdom;

import dominion.Card;
import dominion.CardTypes;
import dominion.Dominion;
import dominion.Player;

public class Militia extends AbstractAttackAction {

	@Override
	public void execute(Dominion dominion) {
		Player player = dominion.current();
		player.addTemporaryCoin(2);
		for (Player p : dominion.waitings()) {
			if (hasMoat(p) == false) {
				while (3 < p.hand().size()) {
					Card c = p.hand().remove(0);
					p.discard(c);
				}
			}
		}
	}

	@Override
	public CardTypes getType() {
		return CardTypes.Militia;
	}

	@Override
	public String toString() {
		return getType().name();
	}
}
